/****************************************************************
 *  * *Process the diff os interface
 *  * *
 *  * *file name:mct_resmgr.h
 *  * *
 *  * *Copyright (C)2012 Cisco webex.
 *  * *All rights reserved
 *  * *
 *  * *Author:zhenye
 *  * *Date  :2013-04-28
 *  * *
 *  * ****************************************************************/

#ifndef _MCT_RESMGR_H_
#define _MCT_RESMGR_H_

/**
*  CMMObjMemoryGuard for guard memory alloc by MCT_malloc
*/
class CMCTMemoryGuard
{
public:

    template<class T>
    CMCTMemoryGuard(T *&pData)
    {
        m_ppData =  (VOID**) (&pData);
    }

    ~CMCTMemoryGuard()
    {
        if (NULL == *m_ppData)
        {
            return;
        }
        MCT_free(m_ppData);
    }

private:
    VOID **m_ppData;
};

/** c++ auto_ptr for guard memory alloc by new
**/
/* std::auto_ptr<T> poData = std::auto_ptr<T>(new T); */

/** ACE_Thread_Mutex: type of mutex for thread
 ** oGuard                 : guard temp var name
 ** oLock                  : object of mutex, for thread mutex type is: ACE_Thread_Mutex
 ** error_return          : return value for failed lock mutex
**/
/* ACE_GUARD_RETURN(ACE_Thread_Mutex, oGuard, oLock, error_return); */

/** ACE_Thread_Mutex: type of mutex for thread
 ** oGuard                 : guard temp var name
 ** oLock                  : object of mutex, for thread mutex type is: ACE_Thread_Mutex
**/
/* ACE_GUARD(ACE_Thread_Mutex, oGuard, oLock, error_return); */


#endif /* _MCT_RESMGR_H_ */
